package com.internetCafes.spms.web.sys.controller;


import com.internetCafes.spms.common.base.BaseWebController;
import com.internetCafes.spms.common.utils.ShiroUtils;
import com.internetCafes.spms.core.annotation.SysLog;
import com.internetCafes.spms.core.utils.R;
import com.internetCafes.spms.web.sys.model.AdviceFeedback;
import com.internetCafes.spms.web.sys.service.IAdviceFeedbackService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LinYe
 * @since 2021-01-14
 */
@RestController
@RequestMapping("/sys/advice-feedback")
public class AdviceFeedbackController extends BaseWebController {

    @Autowired
    IAdviceFeedbackService adviceFeedbackService;

    @SysLog("提交问题反馈")
    @PostMapping("/save")
    @RequiresPermissions("sys:advice:save")
    public R save(@RequestBody AdviceFeedback entity) {
        entity.setCreateBy(ShiroUtils.getUserId());
        entity.setCreateTime(new Date());
        adviceFeedbackService.save(entity);
        return R.ok();
    }

}
